VERSION		:= 0
PATCHLEVEL	:= 0
COMPILATION	:= 1
VERSION_STRING	:= $(VERSION).$(PATCHLEVEL).$(COMPILATION)

CROSS_COMPILE	?= 
PREFIX		?= 

CPP			:= $(CROSS_COMPILE)gcc -E
CC			:= $(CROSS_COMPILE)gcc
LD			:= $(CROSS_COMPILE)gcc
SIZE		:= $(CROSS_COMPILE)size
STRIP		:= $(CROSS_COMPILE)strip
INSTALL		:= install
DEBUG		:= 
STATIC		:= -static
OPT			:= -O3

TARGET		:= fbplasma

.PHONY: all
all: $(TARGET)

cppflags-y	:= -DVERSION_STRING=\"$(VERSION_STRING)\"
cflags-y	:= -pipe $(OPT) $(DEBUG) -Wall -static
ldflags-y	:= -lm
ldflags-y	+= 

obj-y		:= main.o plasma.o

CPPFLAGS	:= $(cppflags-y)
CFLAGS		:= $(cflags-y)
LDFLAGS		:= $(ldflags-y)

DEP		:= $(addprefix .dep.,$(obj-y)) 
-include $(DEP)

$(TARGET): $(obj-y)
	$(LD) $(STATIC) -o $@ $(obj-y) $(LDFLAGS) 
	$(STRIP) $@
	$(SIZE) $@

.PHONY: clean
clean:
	$(RM) $(DEP)
	$(RM) $(obj-y)
	$(RM) $(TARGET)

%.o: %.c
	$(CC) -c $< -o  $@ $(CPPFLAGS) $(CFLAGS) -MD -MF .dep.$@ -MP -MQ $@

